"use strict";(globalThis.webpackChunk_wcAdmin_webpackJsonp=globalThis.webpackChunk_wcAdmin_webpackJsonp||[]).push([[8994],{8994:(M,I,N)=>{N.r(I);var j=N(69307),g=N(67221),i=N(9818),D=N(98817),e=N(32162),z=N(94333),c=N(65736),o=N(92819),t=N(86020),S=N(55609),T=N(14599),u=N(64214);const A=M=>{let{onConnect:I}=M;return(0,j.createElement)(u.Z,{onConnect:()=>{(0,T.recordEvent)("tasklist_shipping_recommendation_connect_store",{connect:!0}),null==I||I()}})};var n=N(75283),a=N(14812),y=N(34704);const l=M=>"object"==typeof M&&null!==M,O=M=>{let{nextStep:I,pluginsToActivate:N}=M;const{updateOptions:D}=(0,i.useDispatch)(g.OPTIONS_STORE_NAME),{isResolving:e,tosAccepted:z}=(0,i.useSelect)((M=>{const{getOption:I,hasFinishedResolution:N}=M(g.OPTIONS_STORE_NAME),j=I("wc_connect_options");return{isResolving:!N("getOption",["woocommerce_setup_jetpack_opted_in"])||!N("getOption",["wc_connect_options"]),tosAccepted:l(j)&&(null==j?void 0:j.tos_accepted)||"1"===I("woocommerce_setup_jetpack_opted_in")}}));(0,j.useEffect)((()=>{z&&!N.length&&I()}),[I,N,z]);const o=N.includes("woocommerce-services")?(0,c.__)("By installing Jetpack and WooCommerce Shipping you agree to the {{link}}Terms of Service{{/link}}.","woocommerce"):(0,c.__)("By installing Jetpack you agree to the {{link}}Terms of Service{{/link}}.","woocommerce");return e?null:(0,j.createElement)(j.Fragment,null,(0,j.createElement)(t.Plugins,{onComplete:(M,N)=>{(0,y.a)(N),(0,T.recordEvent)("tasklist_shipping_recommendation_install_extensions",{install_extensions:!0}),D({woocommerce_setup_jetpack_opted_in:!0}),I()},onError:(M,I)=>(0,y.a)(I),pluginSlugs:N}),!z&&(0,j.createElement)(a.Text,{variant:"caption",className:"woocommerce-task__caption",size:"12",lineHeight:"16px",style:{display:"block"}},(0,n.Z)({mixedString:o,components:{link:(0,j.createElement)(t.Link,{href:"https://wordpress.com/tos/",target:"_blank",type:"external"},(0,j.createElement)(j.Fragment,null))}})))};var C=N(82580),s=N(33414),L=N(58670);const m=M=>{let{nextStep:I,onLocationComplete:N}=M;const{createNotice:D}=(0,i.useDispatch)("core/notices"),{updateAndPersistSettingsForGroup:e}=(0,i.useDispatch)(g.SETTINGS_STORE_NAME),{generalSettings:z,isResolving:c}=(0,i.useSelect)((M=>{var I;const{getSettings:N,hasFinishedResolution:j}=M(g.SETTINGS_STORE_NAME);return{generalSettings:null===(I=N("general"))||void 0===I?void 0:I.general,isResolving:!j("getSettings",["general"])}}));return(0,j.useEffect)((()=>{!c&&(0,s.AO)(z||{})&&N()}),[z,N,c]),c?null:(0,j.createElement)(L.Z,{onComplete:M=>{const N=(0,C.so)(M.countryState);(0,T.recordEvent)("tasklist_shipping_recommendation_set_location",{country:N}),I()},isSettingsRequesting:!1,settings:z,updateAndPersistSettingsForGroup:e,createNotice:D})};var Y=N(35484),E=N(43347),d=N(42701),w=N(91127),x=N(67097);const Z=[{icon:E,title:(0,c.__)("Buy postage when you need it","woocommerce"),description:(0,c.__)("No need to wonder where that stampbook went.","woocommerce")},{icon:d,title:(0,c.__)("Print at home","woocommerce"),description:(0,c.__)("Pick up an order, then just pay, print, package and post.","woocommerce")},{icon:w,title:(0,c.__)("Discounted rates","woocommerce"),description:(0,c.__)("Access discounted shipping rates with DHL and USPS.","woocommerce")}],k=()=>(0,j.createElement)(x.L,{logo:{image:Y},features:Z});var p=N(74617);const Q=["jetpack","woocommerce-services"],r=(0,z.compose)((0,i.withSelect)((M=>{var I;const{getSettings:N}=M(g.SETTINGS_STORE_NAME),{hasFinishedResolution:j}=M(g.OPTIONS_STORE_NAME),{getActivePlugins:i}=M(g.PLUGINS_STORE_NAME);return{activePlugins:i(),generalSettings:null===(I=N("general"))||void 0===I?void 0:I.general,isJetpackConnected:M(g.PLUGINS_STORE_NAME).isJetpackConnected(),isResolving:!j("getOption",["woocommerce_setup_jetpack_opted_in"])||!j("getOption",["wc_connect_options"])||!M(g.PLUGINS_STORE_NAME).hasFinishedResolution("isJetpackConnected")}})))((M=>{let{activePlugins:I,isJetpackConnected:N,isResolving:g}=M;const[i,D]=(0,j.useState)([]),[e,z]=(0,j.useState)(0),[T,u]=(0,j.useState)(!1),[n,a]=(0,j.useState)(!1),y=()=>{z(e+1)},l=()=>{var M;u(!0),null!==(M=window)&&void 0!==M&&M.location&&(window.location.href=(0,p.getAdminLink)("admin.php?page=wc-settings&tab=shipping&section=woocommerce-services-settings"))};(0,j.useEffect)((()=>{const M=(0,o.difference)(Q,I);!g&&0===M.length&&N&&l(),M.length<=i.length||D(M)}),[I,N,g,i]);const C=[{key:"store_location",label:(0,c.__)("Set store location","woocommerce"),description:(0,c.__)("The address from which your business operates","woocommerce"),content:(0,j.createElement)(m,{nextStep:y,onLocationComplete:()=>{n||(a(!0),y())}}),onClick:()=>{z(0)}},{key:"plugins",label:i.includes("woocommerce-services")?(0,c.__)("Install Jetpack and WooCommerce Shipping","woocommerce"):(0,c.__)("Install Jetpack","woocommerce"),description:(0,c.__)("Enable shipping label printing and discounted rates","woocommerce"),content:(0,j.createElement)("div",null,(0,j.createElement)(k,null),(0,j.createElement)(O,{nextStep:y,pluginsToActivate:i}))},{key:"connect",label:(0,c.__)("Connect your store","woocommerce"),description:(0,c.__)("Connect your store to WordPress.com to enable WooCommerce Shipping","woocommerce"),content:N?(0,j.createElement)(S.Button,{onClick:l,isBusy:T,isPrimary:!0},(0,c.__)("Complete task","woocommerce")):(0,j.createElement)(A,{onConnect:l})}],s=C[e];return(0,j.createElement)("div",{className:"woocommerce-task-shipping-recommendation"},(0,j.createElement)(S.Card,{className:"woocommerce-task-card"},(0,j.createElement)(S.CardBody,null,(0,j.createElement)(t.Stepper,{isPending:g,isVertical:!0,currentStep:s.key,steps:C}))))}));(0,D.registerPlugin)("wc-admin-onboarding-task-shipping-recommendation",{scope:"woocommerce-tasks",render:()=>(0,j.createElement)(e.WooOnboardingTask,{id:"shipping-recommendation"},(M=>{let{onComplete:I,query:N,task:g}=M;return(0,j.createElement)(r,{onComplete:I,query:N,task:g})}))})},91127:M=>{M.exports=""},42701:M=>{M.exports=""},43347:M=>{M.exports=""},35484:M=>{M.exports=""}}]);